import { Controller } from "egg";

class HomeController extends Controller {
  async index() {
    const { ctx } = this;
    ctx.type = "text/html";
    ctx.body = `
      <!doctype html>
      <html>
        <head><meta charset="utf-8"><title>Charity Backend</title></head>
        <body>
          <h1>Charity Backend</h1>
          <p>健康检查: <a href="/api/health">/api/health</a></p>
          <p>钱包绑定演示页面: <a href="/public/wallet-verify.html">/public/wallet-verify.html</a></p>
        </body>
      </html>
    `;
  }

  async health() {
    const { ctx } = this;
    ctx.body = {
      status: "ok",
      timestamp: new Date().toISOString(),
      uptime: process.uptime(),
    };
  }
}

export default HomeController;
